home *** CD-ROM | disk | FTP | other *** search
/ United Public Domain Gold 2 / United Public Domain Gold 2.iso / utilities / pu168a.dms / pu168a.adf / Scripts / tutorial18.art < prev    next >
Text File  |  1991-11-11  |  3KB  |  137 lines

  1. !---------------------------------------------------------------
  2. !
  3. ! TUTORIAL18 - RayDance tutorial script #18.
  4. !
  5. ! This script demonstates projective texture mapping.
  6. !
  7. ! Concepts include :
  8. !
  9. !  o PLANE, CYLINDER, and SPHERE texture mapping
  10. !
  11. !---------------------------------------------------------------
  12.  
  13. ! Use a print statement to display descriptive text on the
  14. ! message window.
  15.  
  16.  
  17. ? "TUTORIAL18 - This script creates six lathed objects and\n",
  18.   "texture maps a picture onto them.  The top and bottom\n",
  19.   "rows represent top and front views (respectively) of the\n",
  20.   "objects.  The left most objects are PLANE mapped, the\n",
  21.   "middle objects are CYLINDER wrapped, and the right most\n",
  22.   "objects are SPHERE mapped.  All mapping is done with the\n",
  23.   "same picture file (texture map array).\n\n";
  24.  
  25.  
  26. ! Variables
  27.  
  28. integer  SEGMENTS = 32;     ! # of steps around lathed objects
  29. real     ANGLE = 360;       ! Lathe a complete revolution
  30. vector   SCALING = [1,1,1]; ! Full size
  31.  
  32. vector   POS1A = [-400,0,200],
  33.          POS1B = [-400,0,-200],
  34.          POS2A = [   0,0,200],
  35.          POS2B = [   0,0,-200],
  36.          POS3A = [ 400,0,200],
  37.          POS3B = [ 400,0,-200];
  38.  
  39.  
  40. ! Load the texture map array
  41.  
  42. OURMAP : texturemap( "bricks4.ilbm" );
  43.  
  44.  
  45. ! Make up a surface for our objects
  46.  
  47. MATTE : surface(PHONG, 0.8,1, 0,0, 0,0,0, 0, 0 );
  48.  
  49.  
  50. ! Create our outline (for rotation around the z axis)
  51.  
  52. OUROUTLINE : outline[5] = (
  53.   [0,0,-140], [100,0,-140], [130,0,0], [100,0,140], [0,0,140]
  54. );
  55.  
  56.  
  57. ! Create the left-most objects and PLANE map them.
  58.  
  59. MAP1A : texture( PLANE, ourmap, POS1A, [0,0,1], [1,0,0],
  60.   280,285,285, 2,2, SMOOTH5 );
  61.  
  62. MAP1B : texture( PLANE, ourmap, POS1B, [0,1,0], [1,0,0],
  63.   280,285,285, 2,2, SMOOTH5 );
  64.  
  65. lathe( ( OUROUTLINE ),
  66.   SEGMENTS, ANGLE, 0, SCALING, POS1A, [90,0,0],
  67.   MAP1A, MATTE, PHONG|ZAXIS );
  68.  
  69. lathe( ( OUROUTLINE ),
  70.   SEGMENTS, ANGLE, 0, SCALING, POS1B, [0,0,0],
  71.   MAP1B, MATTE, PHONG|ZAXIS );
  72.  
  73.  
  74. ! Create the central objects and CYLINDER map them.
  75.  
  76. MAP2A : texture( CYLINDER, ourmap, POS2A, [0,-1,0], [1,0,0],
  77.   285, 2,2, SMOOTH5 );
  78.  
  79. MAP2B : texture( CYLINDER, ourmap, POS2B, [0,0,1], [1,0,0],
  80.   285, 2,2, SMOOTH5 );
  81.  
  82. lathe( ( OUROUTLINE ),
  83.   SEGMENTS, ANGLE, 0, SCALING, POS2A, [90,0,0],
  84.   MAP2A, MATTE, PHONG|ZAXIS );
  85.  
  86. lathe( ( OUROUTLINE ),
  87.   SEGMENTS, ANGLE, 0, SCALING, POS2B, [0,0,0],
  88.   MAP2B, MATTE, PHONG|ZAXIS );
  89.  
  90.  
  91. ! Create the right-most objects and SPHERE map them.
  92.  
  93. MAP3A : texture( SPHERE, ourmap, POS3A, [0,-1,0], [1,0,0],
  94.   2,2, SMOOTH5 );
  95.  
  96. MAP3B : texture( SPHERE, ourmap, POS3B, [0,0,1], [1,0,0],
  97.   2,2, SMOOTH5 );
  98.  
  99. lathe( ( OUROUTLINE ),
  100.   SEGMENTS, ANGLE, 0, SCALING, POS3A, [90,0,0],
  101.   MAP3A, MATTE, PHONG|ZAXIS );
  102.  
  103. lathe( ( OUROUTLINE ),
  104.   SEGMENTS, ANGLE, 0, SCALING, POS3B, [0,0,0],
  105.   MAP3B, MATTE, PHONG|ZAXIS );
  106.  
  107.  
  108. ! Specify the ambient light.
  109.  
  110. AMBIENT( [0,0,0], [0.6,0.6,0.6], [0,0,1], 0, 0 );
  111.  
  112. ! Specify the STAR light.
  113.  
  114. STAR( [40000,-50000,60000], [1,.9,1], 300 );
  115.  
  116.  
  117. ! Set the background color to a dark purple
  118.  
  119. BACKGROUND( PLAIN, [0,0.05,0.15] );
  120.  
  121.  
  122. ! The camera will be positioned along the negative y axis aiming
  123. ! toward the central objects
  124.  
  125. CAMERA'POS = [0,-1700,550];
  126. CAMERA'TARGET = (POS2A+POS2B)*0.5; ! between the two objects
  127.  
  128.  
  129. ! The scene has now been constructed, render it!
  130.  
  131. RENDER;
  132.  
  133.  
  134. ! All scripts must terminate with an END
  135.  
  136. END
  137.